package com.lngsyz.ywtb.enumeration;

import org.apache.commons.lang.StringUtils;

/**
 * 支付状态
 * 
 */

public enum Pay {
	PAY_NO("未支付", "0"),
	PAY_YES("已支付", "1"),
	PAY_REFUND("已退款", "8"),
	PAY_CLOSED("交易关闭", "9");

	private String name;
	private String key;

	private Pay(String name, String key) {
		this.name = name;
		this.key = key;
	}

	public static String getNameByKey(String key) {
		if(StringUtils.isNotBlank(key)) {
			for (Pay state : Pay.values()) {
				if (state.getKey().equalsIgnoreCase(key)) {
					return state.getName();
				}
			}
		}
		return "";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}
}
